<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>员工详情 - HRM系统</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <link rel="stylesheet" th:href="@{/css/employee-view.css}">
</head>
<body>
<div class="dashboard">
    <header class="header">
        <div class="logo">HRM系统</div>
        <div class="user-info">
            <span th:text="${currentUser.realName}"></span>
            <span class="role-badge" th:text="${currentUser.roleId.roleName}"></span>
            <a href="/logout" class="logout-btn">退出</a>
        </div>
    </header>
    <main class="employee-view-container">
        <!-- 返回按钮 -->
        <div class="back-container">
            <a th:href="@{/employee}" class="btn btn-back">← 返回员工列表</a>
            <a th:href="@{/home}" class="btn btn-back">← 返回首页</a>
        </div>

        <!-- 页面标题 -->
        <div class="module-header">
            <h1 class="module-title">员工详细信息</h1>
            <div class="action-buttons" th:if="${roleIdValue lt 4}">
                <a th:href="@{/employee/edit/{id}(id=${employee.userId})}" class="btn btn-primary">编辑信息</a>
            </div>
        </div>

        <!-- 员工基本信息卡片 -->
        <div class="employee-card">
            <!-- 基本信息区 -->
            <div class="info-section">
                <h2 class="section-title">基本信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">工号：</span>
                        <span class="info-value" th:text="${employee.username}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">姓名：</span>
                        <span class="info-value" th:text="${employee.realName}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">性别：</span>
                        <span class="info-value" th:text="${employee.gender}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">年龄：</span>
                        <span class="info-value" th:text="${employee.age}"></span>
                    </div>
                </div>
            </div>

            <!-- 身份信息区 -->
            <div class="info-section">
                <h2 class="section-title">身份信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">身份证号：</span>
                        <span class="info-value" th:text="${employee.idNumber}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">出生日期：</span>
                        <span class="info-value" th:text="${#temporals.format(employee.birthday, 'yyyy-MM-dd')}"></span>
                    </div>
                </div>
            </div>

            <!-- 工作信息区 -->
            <div class="info-section">
                <h2 class="section-title">工作信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">部门：</span>
                        <span class="info-value" th:text="${employee.departmentID.departmentName}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">职位：</span>
                        <span class="info-value" th:text="${employee.jobPositionID.positionName}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">入职日期：</span>
                        <span class="info-value" th:text="${#temporals.format(employee.startingDate, 'yyyy-MM-dd')}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">状态：</span>
                        <span class="status-active" th:if="${employee.status}">在职</span>
                        <span class="status-inactive" th:unless="${employee.status}">离职</span>
                    </div>
                </div>
            </div>

            <!-- 教育信息区 -->
            <div class="info-section">
                <h2 class="section-title">教育信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">学历：</span>
                        <span class="info-value" th:text="${employee.education}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">专业：</span>
                        <span class="info-value" th:text="${employee.major}"></span>
                    </div>
                </div>
            </div>

            <!-- 联系信息区 -->
            <div class="info-section">
                <h2 class="section-title">联系信息</h2>
                <div class="info-grid">
                    <div class="info-item">
                        <span class="info-label">邮箱：</span>
                        <span class="info-value" th:text="${employee.email}"></span>
                    </div>
                    <div class="info-item">
                        <span class="info-label">电话：</span>
                        <span class="info-value" th:text="${employee.phone}"></span>
                    </div>
                </div>
            </div>
        </div>
    </main>
</div>
</body>
</html>